<?php
class CommonController extends Yaf_Controller_Abstract {
    public static $config;
    public $view;
   public function init(){
       if(self::$config==null){
        self::$config = Yaf_Application::app()->getConfig();
       }
       $this->view=$this->getView();
       $this->view->assign("logo", "SW-ADMIN");
       $this->view->assign("BASE_URI",self::$config->get('application.baseUri'));
       $this->view->assign("BASE_VIEW_PATH",self::$config->get('application.directory')."views/");
       $this->getView()->setScriptPath(self::$config->get('application.directory')."views");
       $this->checkPrivilege();
   }
   public function checkPrivilege(){
        $req=$this->getRequest();
        $isCheck=PrivilegeModel::isAvailable($req);
        if(!$isCheck){
            $this->display("common/error",array('msg'=>'您没有权限访问此功能')); 
            exit;
        }

   }
}
?>